home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Development Platforms / Apple II / Apple II Sample Code / APW.SC / SC24Teach / Teach.p / Teach.asm next >
Encoding:
Assembly Source File  |  1990-05-03  |  1.9 KB  |  144 lines  |  [TEXT/pdos]

  1.     include 'm16.Util2'
  2.     include 'm16.Stack'
  3.     blanks off
  4.  
  5.  
  6.  
  7.  
  8. C1OutputToC1Input   PROC EXPORT
  9.     DefineStack
  10. OrigD   word
  11. TheRTL  block 3
  12. TheHandle   long
  13.  
  14. SizeInputs  equ 4
  15.  
  16.  
  17.     phd
  18.     tsc
  19.     tcd
  20.     phb ; save dbr
  21.     phk
  22.     plb
  23.  
  24.  
  25.     lda [TheHandle] ; deref the handle
  26.     tax
  27.     ldy #2
  28.     lda [TheHandle],y
  29.     sta TheHandle+2
  30.     stx TheHandle
  31.  
  32.     lda [TheHandle],y   ; copy the length into the first word
  33.     sta [TheHandle]
  34.     tax ; and into the x-reg
  35.     sep #$20
  36.     longa off
  37.  
  38.     beq Done    ; if length is zero, we are done
  39.  
  40. More    iny ; look ahead 2 for next character
  41.     iny
  42.     lda [TheHandle],y
  43.     dey ; store it where we were
  44.     dey
  45.     sta [TheHandle],y
  46.     iny ; bump y by one
  47.     dex ; dec x by one and continue if not zero
  48.     bne More
  49.  
  50.  
  51. Done    rep #$20
  52.     longa on
  53.  
  54.  
  55.     lda TheRTL
  56.     sta TheRTL+SizeInputs
  57.     lda TheRTL+1
  58.     sta TheRTL+1+SizeInputs
  59.     
  60.     plb ; restore dbr
  61.  
  62.  
  63.     pld
  64.     pla
  65.     pla
  66.     
  67.     rtl
  68.  
  69.     endp
  70.  
  71.  
  72.  
  73. C1OutputToPString   PROC EXPORT
  74.     DefineStack
  75. OrigD   word
  76. TheRTL  block 3
  77. TheHandle   long
  78.  
  79. SizeInputs  equ 4
  80.  
  81.  
  82.     phd
  83.     tsc
  84.     tcd
  85.     phb ; save dbr
  86.     phk
  87.     plb
  88.  
  89.  
  90.     lda [TheHandle] ; deref the handle
  91.     tax
  92.     ldy #2
  93.     lda [TheHandle],y
  94.     sta TheHandle+2
  95.     stx TheHandle
  96.  
  97.     lda [TheHandle],y   ; copy the length into the first word
  98.     sta [TheHandle]
  99.     tax ; and into the x-reg
  100.     sep #$20
  101.     longa off
  102.  
  103.     beq Done    ; if length is zero, we are done
  104.  
  105.     dey ; start y at 1
  106.  
  107. More    iny ; look ahead 3 for next character
  108.     iny
  109.     iny
  110.     lda [TheHandle],y
  111.     dey ; store it where we were
  112.     dey
  113.     dey
  114.     sta [TheHandle],y
  115.     iny ; bump y by one
  116.     dex ; dec x by one and continue if not zero
  117.     bne More
  118.  
  119.  
  120. Done    rep #$20
  121.     longa on
  122.  
  123.  
  124.     lda TheRTL
  125.     sta TheRTL+SizeInputs
  126.     lda TheRTL+1
  127.     sta TheRTL+1+SizeInputs
  128.     
  129.     plb ; restore dbr
  130.  
  131.  
  132.     pld
  133.     pla
  134.     pla
  135.     
  136.     rtl
  137.  
  138.     endp
  139.  
  140.  
  141.  
  142.     END
  143.     
  144.